/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.colegiatura.be;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import org.cip.esymons.general.be.PersonaNatural;

/**
 *
 * @author oscar
 */
@Entity
@Table(name = "col_detalleguia")
//@NamedQueries({@NamedQuery(name = "DetalleGuia.findAll", query = "SELECT d FROM DetalleGuia d"), @NamedQuery(name = "DetalleGuia.findByDgrCodigo", query = "SELECT d FROM DetalleGuia d WHERE d.dgrCodigo = :dgrCodigo"), @NamedQuery(name = "DetalleGuia.findByDgrnroCarnet", query = "SELECT d FROM DetalleGuia d WHERE d.dgrnroCarnet = :dgrnroCarnet")})
public class DetalleGuia implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "dgr_codigo")
    private Integer dgrCodigo;
    @Column(name = "dgr_nroCarnet")
    private String dgrnroCarnet;
    @JoinColumn(name = "col_codigo", referencedColumnName = "per_codigo")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private PersonaNatural colCodigo;
    @JoinColumn(name = "gre_codigo", referencedColumnName = "gre_codigo")
    @ManyToOne(fetch = FetchType.LAZY)
    private GuiaRemision greCodigo;

    public DetalleGuia() {
    }

    public DetalleGuia(Integer dgrCodigo) {
        this.dgrCodigo = dgrCodigo;
    }

    public Integer getDgrCodigo() {
        return dgrCodigo;
    }

    public void setDgrCodigo(Integer dgrCodigo) {
        this.dgrCodigo = dgrCodigo;
    }

    public String getDgrnroCarnet() {
        return dgrnroCarnet;
    }

    public void setDgrnroCarnet(String dgrnroCarnet) {
        this.dgrnroCarnet = dgrnroCarnet;
    }

    public PersonaNatural getColCodigo() {
        return colCodigo;
    }

    public void setColCodigo(PersonaNatural colCodigo) {
        this.colCodigo = colCodigo;
    }

    public GuiaRemision getGreCodigo() {
        return greCodigo;
    }

    public void setGreCodigo(GuiaRemision greCodigo) {
        this.greCodigo = greCodigo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (dgrCodigo != null ? dgrCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetalleGuia)) {
            return false;
        }
        DetalleGuia other = (DetalleGuia) object;
        if ((this.dgrCodigo == null && other.dgrCodigo != null) || (this.dgrCodigo != null && !this.dgrCodigo.equals(other.dgrCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.colegiatura.be.DetalleGuia[dgrCodigo=" + dgrCodigo + "]";
    }

}
